{% extends "base.html" %}
{% load static %}
{% block title %}班级信息{% endblock %}
{% block css %}
    <link href="{% static 'css/layui.css' %}" rel="stylesheet">
{% endblock %}
{% block content %}
    <div class="layui-container">
        {# 查询班级模块 #}
        <form action="/getbyname/" method="get">
            <input placeholder="班级名称" name="tName" id="tName">
            <input type="submit" class="layui-btn" value="搜索">
        </form>

        {# 显示所有班级模块 #}
        <table class="layui-table">
      <colgroup>
        <col width="150">
        <col width="200">
        <col>
      </colgroup>
      <thead>
        <tr>
            <th>照片</th>
            <th>学号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>修改</th>
            <th>删除</th>
        </tr>
      </thead>
      <tbody>
        {%for student in studentdata%}
            <tr>
                <td>
                    <img src="{{ student.image }}" height="50px">
                </td>
                <td>{{student.student_id}}</td>
                <td>{{student.name}}</td>
                <td>{{student.age}}</td>
                <td>{{student.sex}}</td>
                <td>
                    {# 修改学生模块 #}
                    <a href="/getbyid/{{ student.student_id }}" class="layui-btn layui-btn-normal">
                        <i class="layui-icon">&#xe642;</i>修改
                    </a>
                </td>
                <td>
                    {# 删除学生模块 #}
                    <a href="/delete_student/{{ student.student_id }}" class="layui-btn layui-btn-danger">
                        <i class="layui-icon">&#xe640;</i>删除
                    </a>
                </td>
            </tr>
        {%endfor%}

      </tbody>
        </table>
        {# 添加学生模块 #}
        <a href="/add_page/" class="layui-btn layui-btn-warm">
            <i class="layui-icon">&#xe654;</i> 添加
        </a>
    </div>
    <div class="layui-container">
            <h1>

        {% for index in studentdata.paginator.page_range %}
            {% if index == studentdata.number %}
                <li style="color: red;display: inline;list-style-type: none">{{ index }}</li>
            {% else %}
                <li style="display: inline;list-style-type: none;">
                <a href="/show_page/{{ index }}">{{ index }}</a>
                </li>
            {% endif %}
        {% endfor %}
            </h1>
    </div>
{% endblock %}